package com.ecoolex.discount.sales.core.manager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ecoolex.discount.sales.core.dao.YWCtripOrderDAO;
import com.ecoolex.discount.sales.entity.YWCtripOrder;
import com.ecoolex.discount.sales.entity.YWCtripOrderExample;

@Service
public class YWCtripOrderManager {
	@Autowired
	private YWCtripOrderDAO dao;

	public YWCtripOrder save(YWCtripOrder order) {
		dao.insert(order);
		return order;
	}

	public YWCtripOrder getOneByOrderNo(String orderNo) {
		YWCtripOrderExample.Criteria criteria = YWCtripOrderExample.newAndCreateCriteria().andOrderNoEqualTo(orderNo);
		return dao.selectOneByExample(criteria.example());
	}

	public YWCtripOrder updateStatus(YWCtripOrder ywCtripOrder) {
		dao.updateByPrimaryKeySelective(ywCtripOrder, YWCtripOrder.Column.status, YWCtripOrder.Column.updateUser,
				YWCtripOrder.Column.updateTime);
		return ywCtripOrder;
	}

}
